import platform = require('../../../../../platform/common/baseCommon');
import bpCommon = require('../../../../../platform/common/bpCommon');
import appClient = require('../../../../../platform/client/appClient');


let moduleName = "platform.client";
let personalpageFactory = new appClient.asyncFactory(bpCommon.INsrxxService, "remoteCall", "nsrxxService");
let personalpage = <bpCommon.INsrxxService>personalpageFactory.getValue();

@platform.addon("个人页面视图", "个人页面视图", moduleName)
@appClient.template('views/userinfo/personalpage.html')
export class personalpageView extends appClient.baseControl {
    $lblusername: JQuery = undefined;
    $djxh: JQuery = undefined;
    $frxm: JQuery = undefined;
    $frsfz: JQuery = undefined;
    $nsrmc: JQuery = undefined;
    onShowed?() {
        if (platform.currentUser && platform.currentUser.userinfo.status == "00") {
            personalpage.querytaxpayerinformation(platform.currentUser).then(rs => {
                debugger;
                let token = rs.body;
                platform.currentUser = token;
                if(platform.currentUser.userinfo.extrainfo.hasOwnProperty('djxh')==true){
                    this.$djxh.text(platform.currentUser.userinfo.extrainfo['djxh']);
                }
                if(platform.currentUser.userinfo.extrainfo.hasOwnProperty('frxm')==true){
                    this.$frxm.text(platform.currentUser.userinfo.extrainfo['frxm']);
                }
                if(platform.currentUser.userinfo.extrainfo.hasOwnProperty('frsfz')==true){
                    this.$frsfz.text(platform.currentUser.userinfo.extrainfo['frsfz']);
                }
                if(platform.currentUser.userinfo.extrainfo.hasOwnProperty('nsrmc')==true){
                    this.$nsrmc.text(platform.currentUser.userinfo.extrainfo['nsrmc']);
                }
            });
            this.$lblusername.text(platform.currentUser.userinfo.name);
        }else{
            appClient.mainApplication.mainForm.navigate('./project/test/config/client/interactivePlatformOfBankTax/userinfo/loginViewConfig', '登录');
        }
        
    }
}